import { stringify } from 'qs';
import request from '@/utils/request';
import {formDataCode} from '@/utils/utils';


// 获取同城配送取货地址
 export async function GetIntraCityAddress(params) {
      return request(`/${window.storeId}/Address/GetIntraCityAddress`);
}

// 保存同城配送取货地址
export async function SaveIntraCityAddress(params) {
    return request(`/${window.storeId}/Address/SaveIntraCityAddress`, {
      method: 'POST',
      body: {
        ...params
      }
    });
}

// 开启同城配送
export async function OpenSameCityDelivery(params) {
  return request(`/${window.storeId}/Express/OpenSameCityDelivery`, {
    method: 'POST',
    body: {
      ...params
    }
  });
}
// 关闭同城配送
export async function CloseSameCityDelivery(params) {
    return request(`/${window.storeId}/Express/CloseSameCityDelivery`, {
      method: 'POST',
      body: {
        ...params
      }
    });
  }

// 同城配送支付方式保存
export async function SaveSameCitySupportPay(params) {
  return request(`/${window.storeId}/Express/SaveSameCitySupportPay`, {
    method: 'POST',
    headers:{
        'Content-Type':"application/x-www-form-urlencoded",        
     },
     body: formDataCode(params)
  });
}

// 获取同城配送配置
export async function GetSameCityConfig(params) {
  return request(`/${window.storeId}/Express/GetSameCityConfig?${stringify(params)}`);
}

// 保存同城配送详情设置
export async function SaveSameCityConfig(params) {
    return request(`/${window.storeId}/Express/SaveSameCityConfig`, {
      method: 'POST',
      body: {
        ...params
      }
    });
}

